package ch.idsia.ai.agents.controllers.myai;

/**
 * Created by IntelliJ IDEA.
 * User: blakekl10
 * Date: Jun 15, 2010
 * Time: 4:21:33 PM
 * To change this template use File | Settings | File Templates.
 */
public class Ratio {
    private int numerator;

    private int denominator;

    public Ratio(int x, int y)
    {
        numerator = x;
        denominator = y;
    }

    public Ratio()
    {
        this(0,0);
    }

    public void incrementTries()
    {
        denominator++;
    }

    public void success()
    {
        numerator++;
    }

    public double getRatio()
    {
        if(denominator != 0)
            return (double)numerator / (double) denominator;
        else
            return 0;
    }

    public int getNumerator()
    {
        return numerator;
    }

    public int getDenominator()
    {
        return denominator;
    }

    public void displayRatio()
    {
        System.out.print(numerator+":"+denominator+"\t");
    }

    public String writeRatio()
    {
        return (""+numerator+":"+denominator);
    }
}
